//
//  LKAboutUsViewController.m
//  Mideleague_Agent
//
//  Created by Zhiwang on 2020/6/28.
//  Copyright © 2020 Zhiwang. All rights reserved.
//

#import "LKAboutUsViewController.h"

@interface LKAboutUsViewController ()

@end

@implementation LKAboutUsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"关于我们";
    [self crateHeaderImageView];
    // Do any additional setup after loading the view.
}
-(void)crateHeaderImageView{
    UIImageView *imageV = [[UIImageView alloc] init];
    imageV.image = [UIImage imageNamed:@"AppIcon60x60"];
    [self.view addSubview:imageV];
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(NAVIGATION_BAR_HEIGHT + 50);
        make.centerX.equalTo(self.view);
    }];
    UIView *versionView = [self createViewWithTile:@"当前版本" AndContent:@"V 5.6.0"];
    [versionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageV.mas_bottom).offset(30);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(62);
    }];
    UIView *versionIntroView = [self createViewWithTile:@"版本介绍" AndContent:@""];
    [versionIntroView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(versionView.mas_bottom).offset(1);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(62);
    }];
    UIView *kefuView = [self createViewWithTile:@"客服电话" AndContent:@"400-800-7260"];
    [kefuView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(versionIntroView.mas_bottom).offset(1);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(62);
    }];
}
-(UIView *)createViewWithTile:(NSString *)title AndContent:(NSString *)content{
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bgView];
    
    LKBaseLabel *headerLabel = [LKBaseLabel labelWithFrame:CGRectZero text:title textColor:[UIColor blackColor] font:[UIFont fontWithName:@"PingFangSC-Regular" size:15] textAlignment:NSTextAlignmentLeft];
    [bgView addSubview:headerLabel];
    [headerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bgView.mas_left).offset(20);
        make.centerY.equalTo(bgView);
    }];
    LKBaseLabel *contenLabel = [LKBaseLabel labelWithFrame:CGRectZero text:content textColor:[UIColor blackColor] font:[UIFont fontWithName:@"PingFangSC-Regular" size:15] textAlignment:NSTextAlignmentLeft];
    [bgView addSubview:contenLabel];
    [contenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bgView.mas_right).offset(-20);
        make.centerY.equalTo(bgView);
    }];
    if ([title isEqualToString:@"客服电话"]) {
        contenLabel.textColor = [UIColor blueColor];
        contenLabel.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap  = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(phoneCall:)];
        [contenLabel addGestureRecognizer:tap];
    }
    return bgView;
}

/// 打电话
/// @param tap 拨打电话
-(void)phoneCall:(UITapGestureRecognizer *)tap{
    NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"400-800-7260"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
